package com.ruoyi.pidaijiData.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.pidaijiData.domain.plat.DataPidaijiPpzyl;
import com.ruoyi.pidaijiData.mapper.DataPidaijiPpzylMapper;
import com.ruoyi.pidaijiData.service.IDataPidaijiPpzylService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.Future;


/**
 * 皮带机跑偏保护作用力测试数据Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-03-04
 */
@Service
public class DataPidaijiPpzylServiceImpl implements IDataPidaijiPpzylService
{
    @Autowired
    private DataPidaijiPpzylMapper dataPidaijiPpzylMapper;

    /**
     * 查询皮带机跑偏保护作用力测试数据
     * 
     * @param ppId 皮带机跑偏保护作用力测试数据主键
     * @return 皮带机跑偏保护作用力测试数据
     */
    @Override
    public DataPidaijiPpzyl selectDataPidaijiPpzylByPpId(Long ppId)
    {
        return dataPidaijiPpzylMapper.selectDataPidaijiPpzylByPpId(ppId);
    }

    /**
     * 查询皮带机跑偏保护作用力测试数据列表
     * 
     * @param dataPidaijiPpzyl 皮带机跑偏保护作用力测试数据
     * @return 皮带机跑偏保护作用力测试数据
     */
    @Override
    public List<DataPidaijiPpzyl> selectDataPidaijiPpzylList(DataPidaijiPpzyl dataPidaijiPpzyl)
    {
        return dataPidaijiPpzylMapper.selectDataPidaijiPpzylList(dataPidaijiPpzyl);
    }

    /**
     * 查询皮带机跑偏保护作用力测试数据
     *
     * @param dataTaskId
     * @return 皮带机能耗测试数据
     */
    @Async("threadPoolKy")
    @Override
    public Future<List<DataPidaijiPpzyl>> selectDataPidaijiPpzylByDataTaskId(Long dataTaskId) {
        List<DataPidaijiPpzyl> dataPidaijiPpzylList = dataPidaijiPpzylMapper.selectDataPidaijiPpzylByDataTaskId(dataTaskId);
        return new AsyncResult<>(dataPidaijiPpzylList);
    }

    /**
     * 新增皮带机跑偏保护作用力测试数据
     *
     * @param dataPidaijiPpzyls 皮带机能耗测试数据
     * @return 结果
     */
    @Override
    public int batchDataPidaijiPpzyl(List<DataPidaijiPpzyl> dataPidaijiPpzyls) {
        return dataPidaijiPpzylMapper.batchDataPidaijiPpzyl(dataPidaijiPpzyls);
    }

    /**
     * 修改皮带机跑偏保护作用力测试数据
     *
     * @param dataTaskId
     * @return 结果
     */
    @Override
    public int updateDataPidaijiNhByDataTaskId(Long dataTaskId) {
        return dataPidaijiPpzylMapper.updateDataPidaijiNhByDataTaskId(dataTaskId);
    }

    /**
     * 修改皮带机跑偏保护作用力测试数据
     *
     * @param ppId
     * @return 结果
     */
    @Override
    public int updateDataPidaijiPpzylByPpId(Long ppId) {
        return dataPidaijiPpzylMapper.updateDataPidaijiPpzylByPpId(ppId);
    }

    /**
     * 新增皮带机跑偏保护作用力测试数据
     * 
     * @param dataPidaijiPpzyl 皮带机跑偏保护作用力测试数据
     * @return 结果
     */
    @Override
    public int insertDataPidaijiPpzyl(DataPidaijiPpzyl dataPidaijiPpzyl)
    {
        dataPidaijiPpzyl.setCreateTime(DateUtils.getNowDate());
        return dataPidaijiPpzylMapper.insertDataPidaijiPpzyl(dataPidaijiPpzyl);
    }

    /**
     * 修改皮带机跑偏保护作用力测试数据
     * 
     * @param dataPidaijiPpzyl 皮带机跑偏保护作用力测试数据
     * @return 结果
     */
    @Override
    public int updateDataPidaijiPpzyl(DataPidaijiPpzyl dataPidaijiPpzyl)
    {
        dataPidaijiPpzyl.setUpdateTime(DateUtils.getNowDate());
        return dataPidaijiPpzylMapper.updateDataPidaijiPpzyl(dataPidaijiPpzyl);
    }

    /**
     * 批量删除皮带机跑偏保护作用力测试数据
     * 
     * @param ppIds 需要删除的皮带机跑偏保护作用力测试数据主键
     * @return 结果
     */
    @Override
    public int deleteDataPidaijiPpzylByPpIds(Long[] ppIds)
    {
        return dataPidaijiPpzylMapper.deleteDataPidaijiPpzylByPpIds(ppIds);
    }

    /**
     * 删除皮带机跑偏保护作用力测试数据信息
     * 
     * @param ppId 皮带机跑偏保护作用力测试数据主键
     * @return 结果
     */
    @Override
    public int deleteDataPidaijiPpzylByPpId(Long ppId)
    {
        return dataPidaijiPpzylMapper.deleteDataPidaijiPpzylByPpId(ppId);
    }
}
